const getTodoList = () => {
	return (dispatch) => {
		fetch('https://www.fastmock.site/mock/29ebf623e2c8f366218993cdf6b1f640/testapi/getTodoList').then(res => {
			if(res.ok){
				console.log(res)//返回的原始数据流
				//console.log(res.json())//json格式化的数据返回promise对象在then回调中接收
				res.json().then(result => {
					console.log(result)
					let action = {
						type: 'getTodoList',
						data: result.data,
					}
					dispatch(action)
				})
			}
		}).catch(err => console.log(err))
	}
}
export {getTodoList}
